package com.bosssoft.trainee.nontax.util.mapper.poDto;

import com.bosssoft.trainee.nontax.entity.dto.UserDto;
import com.bosssoft.trainee.nontax.entity.po.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @Description: user dto po transform util class
 * @Author: Luo WenLong
 * @Date: 2022/6/25 9:04
 */
@Mapper(componentModel = "spring")
public interface UserPoDto {
    /**
     * @Description: po to dto
     * @param user user
     * @return: com.bosssoft.trainee.nontax.entity.dto.UserDto
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:04
     */
    UserDto po2dto(User user);

    /**
     * @Description: po to dto
     * @param users user list
     * @return: java.util.List<com.bosssoft.trainee.nontax.entity.dto.UserDto>
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:06
     */
    List<UserDto> po2dto(List<User> users);

    /**
     * @Description: dto to po
     * @param userDto user
     * @return: com.bosssoft.trainee.nontax.entity.po.User
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:04
     */
    @Mappings({
            @Mapping(target = "updateTime", source = "")
    })
    User dto2po(UserDto userDto);

    /**
     * @Description: dto to po
     * @param userDtos user list
     * @return: java.util.List<com.bosssoft.trainee.nontax.entity.po.User>
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:06
     */
    List<User> dto2po(List<UserDto> userDtos);
}
